// src/MyPlugin.js
import EarthVoice from "./App.vue";

import HandleMsg from "./views/Index.vue";
import VueDOMPurifyHTML from "vue-dompurify-html";
import elementPlus from "element-plus";
import MarkdownIt from "markdown-it";

import { defineComponent, createApp, h } from "vue";
const MyPlugin = {
  install(app, options) {
    const VuePluginConstructor = defineComponent({
      render() {
        // 使用 TestComponent 作为根组件，并传递 options
        return h(EarthVoice, { options });
      },
    }); // 创建一个应用实例，并将其挂载到 body 中的一个 div 元素上
    const container = document.createElement("div");
    document.body.appendChild(container);
    const instance = createApp(VuePluginConstructor);
    instance
      
      .use(VueDOMPurifyHTML)
      .use(elementPlus)
      .use(MarkdownIt)
      .mount(container)

    console.log("插件使用中!!");
  },
};
export default MyPlugin;
// window.MyPlugin = MyPlugin;
